package com.example.administrator.capital.presenter;
import com.example.administrator.capital.model.ItemsModel;
import com.example.administrator.capital.model.base.IActionRequest;
import com.example.administrator.capital.presenter.base.BasePresenter;
import com.example.administrator.capital.presenter.base.IViewBase;
import com.example.administrator.capital.presenter.base.IViewRequest;
import com.lzy.okgo.model.Response;

/**
 * Created by ${ZhouZiWen} on 2017/12/19 0019.
 *
 */

public class ItemsPresenter extends BasePresenter {
    private ItemsModel mItemsModel;
    public ItemsPresenter(IViewBase iViewBase) {
        super(iViewBase);
        mItemsModel = new ItemsModel();
    }

    /**
     * @param iViewRequest
     * 信用卡
     */
    public void project(final IViewRequest<String> iViewRequest,int page){
        mItemsModel.project(new IActionRequest<String>() {
            @Override
            public void failMsg(String var) {
                iViewRequest.onFailMsg(var);
            }

            @Override
            public void code(int code) {
                iViewRequest.onCode(code);
            }

            @Override
            public void success(Response<String> data) {
                iViewRequest.onSuccess(data);
            }

            @Override
            public void fail(Response<String> error) {

            }
        },page);
    }

    /**
     * @param iViewRequest
     * 信用卡详情
     * */
    public void chujie(final IViewRequest<String> iViewRequest, String proid,String pwd,String tzamount){
        mItemsModel.chujie(new IActionRequest<String>() {
            @Override
            public void failMsg(String var) {
                iViewRequest.onFailMsg(var);
            }

            @Override
            public void code(int code) {
                iViewRequest.onCode(code);
            }

            @Override
            public void success(Response<String> data) {
                iViewRequest.onSuccess(data);
            }

            @Override
            public void fail(Response<String> error) {

            }
        },proid,pwd,tzamount);
    }
    public void details(final IViewRequest<String> iViewRequest, String id){
        mItemsModel.details(new IActionRequest<String>() {
            @Override
            public void failMsg(String var) {
                iViewRequest.onFailMsg(var);
            }

            @Override
            public void code(int code) {
                iViewRequest.onCode(code);
            }

            @Override
            public void success(Response<String> data) {
                iViewRequest.onSuccess(data);
            }

            @Override
            public void fail(Response<String> error) {

            }
        },id);
    }

    /**
     * @param iViewRequest
     * @param id
     * @param token
     * 登录后信用卡详情
     */
    public void getCardDetail(final IViewRequest<String>iViewRequest,String id,String token){
        mItemsModel.getCardDetail(new IActionRequest<String>() {
            @Override
            public void failMsg(String var) {
                iViewRequest.onFailMsg(var);
            }

            @Override
            public void code(int code) {
                iViewRequest.onCode(code);
            }

            @Override
            public void success(Response<String> data) {
                iViewRequest.onSuccess(data);
            }

            @Override
            public void fail(Response<String> error) {

            }
        },id,token);
    }

    public void onlinepay(final IViewRequest<String>iViewRequest,String uid,String tranAmt){
        mItemsModel.onlinepay(new IActionRequest<String>() {
            @Override
            public void failMsg(String var) {
                iViewRequest.onFailMsg(var);
            }

            @Override
            public void code(int code) {
                iViewRequest.onCode(code);
            }

            @Override
            public void success(Response<String> data) {
                iViewRequest.onSuccess(data);
            }

            @Override
            public void fail(Response<String> error) {

            }
        },uid,tranAmt);
    }
    /**
     * @param iViewRequest
     * 筛选
     */
    public void getCardFilter(final IViewRequest<String>iViewRequest,String id){
        mItemsModel.getCardFilter(new IActionRequest<String>() {
            @Override
            public void failMsg(String var) {
                iViewRequest.onFailMsg(var);
            }

            @Override
            public void code(int code) {
                iViewRequest.onCode(code);
            }

            @Override
            public void success(Response<String> data) {
                iViewRequest.onSuccess(data);
            }

            @Override
            public void fail(Response<String> error) {

            }
        },id);
    }
    /**
     * @param iViewRequest
     * @param bank_id
     * 信用卡列表
     */
    public void getCardList(final IViewRequest<String>iViewRequest,String status,String bank_id){
        mItemsModel.getCardList(new IActionRequest<String>() {
            @Override
            public void failMsg(String var) {
                iViewRequest.onFailMsg(var);
            }

            @Override
            public void code(int code) {
                iViewRequest.onCode(code);
            }

            @Override
            public void success(Response<String> data) {
                iViewRequest.onSuccess(data);
            }

            @Override
            public void fail(Response<String> error) {

            }
        },status,bank_id);
    }
}
